<?php
namespace app\common\service;

use app\common\util\Sms;
use think\Model;

/**
 * 所有服务层类的父类，必须继承这个类
 * 这里完成权限验证，sid，uid的初始化
 *
 *
 * Class BaseService
 * @package application\common\service
 */
class BaseService extends Model
{
    protected $domain;
    protected $pageSize = 10; //默认分页条数

    public function __construct(){
        $this->domain = 'http://'.request()->server('HTTP_HOST');
    }

    /**
     * @param $sid
     * @param $mobile
     * @return bool
     * 发送短信验证码业务逻辑
     */
    public function send_sms_code($sid, $mobile){
        //随机生成验证码
//        $sms_code = Sms::get_send_code(6);
        $sms_code = Sms::get_send_code(4);

        //发送短信验证码
        return Sms::send_sms_code($sid, $mobile, $sms_code);
    }

    //是否为模版店铺
    public function isTemplateStore($sid){
        return config('template_sid') == $sid ? true :false;
    }
}







